﻿// -----------------------------------------------------------------------
// <copyright file="Interval.cs" company="The Usual Dosage">
// © 2013 by Matthew M. Martin
// </copyright>
// -----------------------------------------------------------------------

namespace Cadence.NET
{

    /// <summary>
    /// Describes a time period the CadenceTaskManager will wait between task executions.
    /// </summary>
    public class Interval
    {
        #region Enumerations

        /// <summary>
        /// Run options that indicate how long the manager should run.
        /// </summary>
        public enum IntervalRunOptions
        {
            RunOnce = 0,
            RunInfinite = 1
        }

        /// <summary>
        /// Indicates if the system should adjust the timer based on task duration so a task is performed precisely every
        /// n interval, or if the system should keep the timer running at the same interval regardless.
        /// </summary>
        public enum IntervalPrecision
        {
            Exact = 0,
            Fuzzy = 1
        }

        #endregion Enumerations

        #region Properties

        /// <summary>
        /// Gets or sets the interval schedule.
        /// </summary>
        /// <value>
        /// The schedule.
        /// </value>
        public Time Schedule { get; set; }

        /// <summary>
        /// Indicates how long to wait before the first interval fires.
        /// </summary>
        /// <value>
        /// The start offset.
        /// </value>
        public Time StartOffset { get; set; }

        /// <summary>
        /// Gets or sets the run options.
        /// </summary>
        /// <value>
        /// The run options.
        /// </value>
        public IntervalRunOptions RunOptions { get; set; }

        /// <summary>
        /// Gets or sets the precision.
        /// </summary>
        /// <value>
        /// The precision.
        /// </value>
        public IntervalPrecision Precision { get; set; }

        #endregion Properties
    }
}
